package com.tandashi.springbootstudy01.study.clone;

public class Main {

    /**
     * 浅拷贝：对引用的拷贝，不是对像的拷贝
     * @param args
     * @throws CloneNotSupportedException
     */
    public static void main(String[] args) throws CloneNotSupportedException {
        Person person = new Person("zhangsan",18);
        Address address = new Address("山西省","霍州市");
        person.setAddress(address);

        System.out.println(person);

        Person person1 = (Person)person.clone();

        System.out.println(person1);

        address.setCity("太原市");
        person.setAddress(address);


        System.out.println(person);
        System.out.println(person1);
    }
}
